package com.lmt.feign;

import com.lmt.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * @Author: Amazing
 * @Date: 2022/7/28 19:39
 * @Version: 1.0
 */
@Component
public class UserFeignClientFallback implements FallbackFactory<UserFeignClient> {

    @Override
    public UserFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return id -> User.builder().id(-1L).name("feign整合hystrix").intro("熔断器生效了").build();
    }
}
